package com.dys.testproject;

import java.util.Scanner;

/**
 * @className: com.dys.testproject.PizzaFactory
 * @description: 披萨工厂类, 用来生产披萨
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/07/22 下午10:57
 */
public class PizzaFactory {

    public static BasePizzeria getPizzaType(int pizzaType) {
        Scanner sc = new Scanner(System.in);
        BasePizzeria basePizzeria = null;
        switch (pizzaType) {
            case 1: {
                System.out.println("请输入培根的克数: ");
                double weight = sc.nextDouble();
                System.out.println("请输入披萨的大小: ");
                int size = sc.nextInt();
                System.out.println("请输入披萨的价格: ");
                double price = sc.nextDouble();
                // 将录入的信息封装为培根披萨
                BaconPizza pg = new BaconPizza("培根披萨", size, price, weight);
                basePizzeria = pg;
            }
            break;
            case 2: {
                System.out.println("请输入你想要加入的水果: ");
                String name = sc.next();
                System.out.println("请输入披萨的大小: ");
                int size = sc.nextInt();
                System.out.println("请输入披萨的价格: ");
                double price = sc.nextDouble();
                // 将录入的信息封装为培根披萨
                FruitPizzas sg = new FruitPizzas("水果披萨", size, price, name);
                basePizzeria = sg;
            }
            break;
            default:
                System.out.println("Invalid pizza type");
        }
        return basePizzeria;
    }
}
